using Holoville.HOTween;
using UnityEngine;

public class ButtonColorSetter : MonoBehaviour
{
	public float transitionTime = 0.2f;

	public Color normalColor;

	public Color pressedColor;

	private UISprite buttonSprite;

	private void Awake()
	{
		HOTween.Init();
		buttonSprite = GetComponent<UISprite>();
	}

	private void OnEnable()
	{
		buttonSprite.color = normalColor;
	}

	private void OnPress(bool value)
	{
		if (value)
		{
			AnimateColor(pressedColor);
		}
		else
		{
			AnimateColor(normalColor);
		}
	}

	private void AnimateColor(Color color)
	{
		HOTween.To(buttonSprite, transitionTime, new TweenParms().Prop("color", color));
	}
}
